/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package dialog;

import main.Demo;
import dto.Application;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import javax.swing.JDialog;

/**
 *
 * @author phat10130059
 */
public class AddBlockWindowDialog extends JDialog {

    private Demo jFrame;
    private AddBlockWindow addBlockWindow;
    
    public AddBlockWindowDialog(Demo jFrame, String type) {
        
        this.jFrame = jFrame;
        
        setTitle(jFrame.TitleAddBlock);
        
        addBlockWindow = new AddBlockWindow(this, this.jFrame,type);
        addBlockWindow.isRunning = true;
        add(addBlockWindow);
        setDefaultCloseOperation(DISPOSE_ON_CLOSE);
        setModalityType(ModalityType.APPLICATION_MODAL);
        setResizable(false);
        setSize(600, 500);
        
        setLocationRelativeTo(null);
        
        this.addWindowListener(new WindowAdapter() {

            @Override
            public void windowClosing(WindowEvent e) {
                addBlockWindow.isRunning = false;
            }
            
        });
        
        
    }
    
    public AddBlockWindowDialog(Demo jFrame, Application app,String type) {
        
        this.jFrame = jFrame;
        
        setTitle(jFrame.TitleEditBlock);
        
        addBlockWindow = new AddBlockWindow(this, this.jFrame,app, type);
        addBlockWindow.isRunning = true;
        add(addBlockWindow);
        setDefaultCloseOperation(DISPOSE_ON_CLOSE);
        setModalityType(ModalityType.APPLICATION_MODAL);
        setResizable(false);
        setSize(600, 500);
        
        setLocationRelativeTo(null);
        
        this.addWindowListener(new WindowAdapter() {

            @Override
            public void windowClosing(WindowEvent e) {
                addBlockWindow.isRunning = false;
            }
            
        });
        
        
    }
}
